// pages/zhiboDetail/zhiboDetail.js
var app = getApp()
var WxParse = require('../../wxParse/wxParse.js');

Page({
  statechange(e) {
    console.log('live-pusher code:', e.errCode)
  },
  onLoad: function (option) {
    var thiz = this
    var PageInterface = app.globalData.domain + app.globalData.PageInterface
    var domain = app.globalData.domain

    //新闻资讯
    wx.request({
      url: PageInterface,
      method: 'POST',
      header: { 'content-type': 'application/x-www-form-urlencoded' },
      data: {
        format_type: 'json',
        api_cate: 'News',
        api: 2001,
        news_id: option.news_id
      },
      success: function (res) {
        if (res.data.data.length > 0) {
          WxParse.wxParse('content', 'html', res.data.data[0].content, thiz, 0);
          thiz.setData({
            news: res.data.data[0]
          })
        }
      }
    })

    wx.getSystemInfo({
      success: function (res) {
        thiz.setData({
          windowHeight: res.windowHeight,
          windowWidth: res.windowWidth
        });
      }
    })

    
  },
   onShareAppMessage: function (res) {
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '热马品牌商城小程序',
      path: '/pages/index/index',
      imageUrl: "/pages/images/logo.png",
      success: function (res) {
        // 转发成功
        wx.showToast({
          title: '转发成功！',
          icon: 'success',
          duration: 2000
        })
      },
      fail: function (res) {
        // 转发失败
      }
    }
  },
})